<?php  if ( ! defined('EXT')) exit('Invalid file request');

/**
 * Weblog Extended
 *
 * An ExpressionEngine Module that allows you to work with the
 * new resources added by the Weblog Extended extension.
 *
 * @package		ExpressionEngine
 * @author		Mozart Petter
 * @copyright	Copyright (c) 2008, Mozart Petter.
 * @license		http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
 * @link		http://projects.mozartpetter.com/projects/show/eewextended
 * @filesource
 * 
 * This work is licensed under the Creative Commons Attribution-Share Alike 2.5 Brazil.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
 */
class Weblog_Extended_CP
{
	
	/**
	 * Current version of the module.
	 */
	public $version = "0.7.1";
	
	/****************************************************************************
	 * SYSTEM FUNCTIONS															*
	 ****************************************************************************/
	
	/**
	 * Install function of module.
	 * 
	 * @return 
	 */
	public function weblog_extended_module_install()
	{
		global $DB;
		
		$DB->query("INSERT INTO 
						exp_modules (module_id, module_name, module_version, has_cp_backend) 
					VALUES ('', 'Weblog_extended', '$this->version', 'n')
					");
					
		return true;
	}
	
	/**
	 * Deinstall function of module.
	 * 
	 * @return 
	 */
	public function weblog_extended_module_deinstall()
	{
		global $DB;
		
		$query = $DB->query("SELECT
						module_id
					FROM
						exp_modules
					WHERE
						module_name = 'Weblog_extended'
					");
		
		$DB->query("DELETE FROM
						exp_module_member_groups 
					WHERE
						module_id = '" . $query->row['module_id'] . "'
					");
					
		$DB->query("DELETE FROM
						exp_modules
					WHERE
						module_name = 'Weblog_extended'
					");
		
		return true;
	}
	
}

?>
